//package ipad.asia.controller;
//
//
//import ipad.asia.utils.FileLocation;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.web.multipart.MultipartFile;
//
//import java.io.IOException;
//import java.io.InputStream;
//
//@Controller
//public class Test {
//    String salt="12345678Efghj";
//    @RequestMapping("/mytest")
//    public String test1(@RequestParam(value = "file",required = false)MultipartFile file,
//                        Model model,
//                        @RequestParam(value = "name",required = false)String name) throws IOException {
//        if(name==null){
//            model.addAttribute("path", FileLocation.path("goutou.jpg"));
//            System.out.println(FileLocation.path("goutou.jpg"));
//            return "test";
//        }
//        model.addAttribute("path", FileLocation.path(file.getOriginalFilename()));
//        InputStream inputStream=file.getInputStream();
//        boolean b = FtpUtil.uploadFile(file.getOriginalFilename(),salt, inputStream);
//        System.out.println(b);
//        return "ok";
//    }
//
//    @RequestMapping("/down")
//    public String test2(@RequestParam(value = "file",required = false)MultipartFile file) throws IOException {
//        boolean b=FtpUtil.downloadFile("goutou.jpg",salt);
//        System.out.println(b);
//        return "ok";
//    }
//}
